package tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.JspFragment;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import java.io.StringWriter;

public class HelloSimpleTag extends SimpleTagSupport {
    @Override
    public void doTag() throws JspException, IOException {
        JspFragment fragment = this.getJspBody();
        StringWriter stringWriter = new StringWriter();
        fragment.invoke(stringWriter);
        String s = stringWriter.toString();
        System.out.println(s);
        JspWriter out = this.getJspContext().getOut();
        out.print("world");
    }
}
